/*
 * Copyright 2012-2014 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.jqd.framework.core.hessian.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 
 * TODO
 * 
 * @author liaozhicheng.cn@gmail.com
 * @date 2012-6-11
 * @since 1.0
 */
public class ServiceRequest implements Serializable {
	
	private static final long serialVersionUID = 6950619525344197628L;
	
	private static final String REQUESTED_ACTION_ID = "REQUESTED_ACTION_ID";
	
	private static final String REQUESTED_ACTION_METHOD = "REQUESTED_ACTION_METHOD";
	
	private static final String CURRENT_REQUEST_OBJECT = "CURRENT_REQUEST_OBJECT";
	
	private Map<String, Object> model;
	
	
	public ServiceRequest() {
		this.model = new HashMap<String, Object>();
	}
	
	
	public ServiceRequest(Map<String, Object> model) {
		if (model != null)
			this.model = model;
		else
			this.model = new HashMap<String, Object>();
	}
	
	
	public Object getParameter(String parameterKey) {
		return this.model.get(parameterKey);
	}
	
	
	public void setParameter(String parameterKey, Object parameter) {
		this.model.put(parameterKey, parameter);
	}
	
	
	public void setRequestedActionID(String serviceID) {
		this.model.put(REQUESTED_ACTION_ID, serviceID);
	}
	
	
	public String getRequestedActionID() {
		return ((String) this.model.get(REQUESTED_ACTION_ID));
	}
	
	
	public void setRequestedActionOperation(String operationName) {
		this.model.put(REQUESTED_ACTION_METHOD, operationName);
	}
	
	
	public String getRequestedActionOperation() {
		return ((String) this.model.get(REQUESTED_ACTION_METHOD));
	}
	
	
	public Object getCurrentRequestObject() {
		return this.model.get(CURRENT_REQUEST_OBJECT);
	}
	
	
	public void setCurrentRequestObject(Object obj) {
		this.model.put(CURRENT_REQUEST_OBJECT, obj);
	}
	
	
	public Map<String, Object> getParameters() {
		return this.model;
	}
	
	
	public void setParameters(Map<String, Object> model) {
		this.model = model;
	}
	
}
